Salesforce Library Object
From APA 7.6, the Real-Time Designer provides functionality for connecting directly to Salesforce and handling Salesforce objects. By connecting directly to Salesforce, your solution can query Salesforce using Salesforce Object Query Language (SOQL) and/or Salesforce Object Search Language (SOSL), and then create, delete or update Salesforce objects.
From 7.7, the Salesforce library was expanded to include new functions to upload and download attachments, a function to connect to Salesforce using Webform, and support for compound fields.
A SOQL query is the equivalent of a SELECT SQL statement and searches the org database. SOSL is a programmatic way of performing a text-based search against the search index.
Use SOQL when you know which objects the data resides in, and you want to:
-
Retrieve data from a single object or from multiple objects that are related to one another.
-
Count the number of records that meet specified criteria.
-
Sort results as part of the query.
-
Retrieve data from number, date, or checkbox fields.
Use SOSL when you don’t know which object or field the data resides in, and you want to:
-
Retrieve data for a specific term that you know exists within a field. Because SOSL can tokenize multiple terms within a field and build a search index from this, SOSL searches are faster and can return more relevant results.
-
Retrieve multiple objects and fields efficiently where the objects might or might not be related to one another.
-
Retrieve data for a particular division in an organization using the divisions feature.
For details on incorporating this functionality into your solutions, see Using Salesforce Library.
In the Project tab, the References > Library References includes the Direct.Salesforce.Library
This library includes the following business entities:
-
Salesforce Attachment Info, found in Business Entities > Library Types > Salesforce, which contains the attachment details. For details, see Salesforce Attachment INFO.
-
Salesforce Compound Field, found in Business Entities > Library Types > Salesforce, which contains the compound field details. For details, see Salesforce Compound Field.
-
Salesforce Connection, found in Business Entities > Library Types > Salesforce, which contains the properties and functions you need to establish an authenticated connection with Salesforce. For details, see Salesforce Connection Business Entity
-
Salesforce Object, found in Business Entities > Library Types > Salesforce, which contains the results of the SOQL and SOSL queries. For details, see Salesforce Object Business Entity.
-
Salesforce, found in Business Entities > Library Types > Salesforce, which contains the properties and functions you need to query Salesforce and create, delete, and update Salesforce objects. For details, see Salesforce Library Functions.
A successful connection to Salesforce is a precondition for using the functions that access Salesforce objects. If the connection gets disconnected, you will have to connect again for your solution to continue working.
The library is exposed under Project > References > Library References > Salesforce .
Salesforce Attachment INFO
The Salesforce Attachment Info business entity found in Business Entities > Library Types > Salesforce holds the attachment details.
The Salesforce Attachment Info business entity includes the following properties:
Property |
Input Type |
Description |
---|---|---|
Attachment Id | Text | A unique identifier of the attachment. |
File Name | Text | The file name. |
File Size | Number |
The file size. |
Last Modified | DateTime |
The date and time the attachment was last updated. |
Salesforce Compound Field
The Salesforce Attachment Info business entity found in Business Entities > Library Types > Salesforce holds the compound field details.
The Salesforce Compound Field business entity includes the following properties:
Property |
Input Type |
Description |
---|---|---|
Field Properties | List of KeyValuePair | A list of key value pairs of the field properties and values. |
File Name | Text | The field name. |
Salesforce Connection Business Entity
The Salesforce Connection business entity contains the properties and functions for establishing an authenticated connection with Salesforce. This business entity is found in Business Entities > Library Types > Salesforce.
The Salesforce Connection business entity includes the following properties:
Property |
Input Type |
Description |
---|---|---|
Is Connected | Boolean | A read-only Boolean property that indicates if a connection has been established with Salesforce. The value of this property is updated to True when the connection succeeds, and to False when the connection is disconnected. while the value of this property is False, all the functions that require access to Salesforce objects will fail. |
Once you have defined an instance of the Salesforce Connection business entity, use one the following function to connect to the Office 365 server.

Connects to Salesforce using the specified username and password. This function sets the Is Connected property (in the Saleforce Connection business entity) to True if successful, otherwise it sets it to False.
For security reasons, NICE strongly recommends not hard-coding passwords for this functionality into the solution. Instead, the Client Credentials Management functionality should be used where credentials are stored at the server side and only accessed on use.
Parameter | Input | Description |
---|---|---|
Application Key |
Text |
The application key with which to connect to Salesforce. |
Application Secret |
Text |
The application secret with which to connect to Salesforce. |
User Name |
Text |
The username with which to connect to Salesforce. |
Password |
Text |
The password with which to connect to Salesforce. |
Security Token | Text | The security token with which to connect to Salesforce. Refer to the Salesforce REST API Developer Guide for ore information on how to generate the security token. |
Endpoint URL | Text | The Salesforce endpoint URL. |
Returns
Returns a Boolean value of True if the connection was successful, otherwise returns False.

Disconnects from Salesforce. It is recommended to always disconnect using this function when you no longer require access to Salesforce.
This function does not use any parameters. This function always sets the Is Connected property (in the Saleforce Connection business entity) to False.
Returns
Returns a Boolean value of True if the connection was disconnected successful, otherwise returns False.

Connects to Salesforce using the specified application key and secret. This function sets the Is Connected property (in the Saleforce Connection business entity) to True if successful, otherwise it sets it to False.
Parameter | Input | Description |
---|---|---|
Application Key |
Text |
The application key with which to connect to Salesforce. |
Application Secret |
Text |
The application secret with which to connect to Salesforce. |
RedirectUrl URL | Text | The redirect URL. |
Is Sandbox | Boolean | Whether this is the Salesforce sandbox. |
Returns
Returns a Boolean value of True if the connection was successful, otherwise returns False.
Salesforce Object Business Entity
The Salesforce Object business entity found in Business Entities > Library Types > Salesforce holds the query result details.
The Salesforce Object business entity includes the following properties:
Property |
Input Type |
Description |
---|---|---|
Attributes | List of KeyValuePair | A list of key value pairs of the attributes and values. |
Id | Text | A unique identifier of the Salesforce object. |
Properties | List of KeyValuePair |
A list of the object properties and values. |
Raw Json | Text |
A raw JSON string of the result returned by the query. |
Salesforce Library Functions
The library functions for accessing and manipulating Salesforce objects are exposed under Library Objects > Salesforce.
A successful connection to Salesforce is a precondition for using the functions that access Salesforce objects. If the connection gets disconnected, you will have to connect again for your solution to continue working.

Executes an SOQL query, for example, SELECT Description, Subject FROM Case WHERE Subject = 'New Subject'.
Parameter | Input | Description |
---|---|---|
Connection |
Salesforce Connection |
A Salesforce Connection business entity that has established a connection with Salesforce. |
Text |
Text |
The SOQL query. |
Returns
List of Salesforce Query Result

Executes an SOSL query, for example, FIND {nice.com} IN Email Fields RETURNING Contact (name, phone, email).
Parameter | Input | Description |
---|---|---|
Connection |
Salesforce Connection |
A Salesforce Connection business entity that has established a connection with Salesforce. |
Text |
Text |
The SOSL query. |
Returns
List of Salesforce Query Result

Creates a Salesforce object.
Parameter | Input | Description |
---|---|---|
Connection |
Salesforce Connection |
A Salesforce Connection business entity that has established a connection with Salesforce. |
Object Type |
Text |
The Salesforce object type. |
Properties | List of KeyValuePair | A key value pair list of the object properties and their values. You must provide at least the mandatory attributes in the attributes list. This varies depending on the Salesforce object. |
Returns
Returns the Id of the created object (text).

Deletes a Salesforce object.
Parameter | Input | Description |
---|---|---|
Connection |
Salesforce Connection |
A Salesforce Connection business entity that has established a connection with Salesforce. |
Object Type |
Text |
The Salesforce object type. |
Id | Text | The object Id. |
Returns
Returns a Boolean value of True if the deletion was successful, otherwise returns False.

Updates a Salesforce object. Ensure that you only provide attributes that exist in the updated object.
Parameter | Input | Description |
---|---|---|
Connection |
Salesforce Connection |
A Salesforce Connection business entity that has established a connection with Salesforce. |
Object Type |
Text |
The Salesforce object type. |
Id | Text | The object Id. |
Properties | List of KeyValuePair | A key value pair list of the object properties and their values. |
Returns
Returns a Boolean value of True if the update was successful, otherwise returns False.

Downloads a list of Salesforce attachments.
Parameter | Input | Description |
---|---|---|
Connection |
Salesforce Connection |
A Salesforce Connection business entity that has established a connection with Salesforce. |
Object Type |
Text |
The Salesforce object type. |
Id | Text | The object Id. |
Returns
Returns a key value pair list of the object attachments.

Downloads a Salesforce object.
Parameter | Input | Description |
---|---|---|
Connection |
Salesforce Connection |
A Salesforce Connection business entity that has established a connection with Salesforce. |
Attachment Info |
Salesforce Attachment Info |
The Salesforce object type. |
Path | Text | The Salesforce attachment path. |
Overwrite | Boolean | Whether or not to replace the attachment if it exists. |
Returns
Returns a Boolean value of True if the download was successful, otherwise returns False.

Downloads a Salesforce object by name.
Parameter | Input | Description |
---|---|---|
Connection |
Salesforce Connection |
A Salesforce Connection business entity that has established a connection with Salesforce. |
Type | Text | The type of attachment. |
Id |
Text |
The attachment id. |
Name |
Text |
The attachment name. |
Path | Text | The Salesforce attachment path. |
Overwrite | Boolean | Whether or not to replace the attachment if it exists. |
Returns
Returns a Boolean value of True if the download was successful, otherwise returns False.

Uploads a Salesforce object.
Parameter | Input | Description |
---|---|---|
Connection |
Salesforce Connection |
A Salesforce Connection business entity that has established a connection with Salesforce. |
Attached Object Type |
Text |
The Salesforce object type. |
Attached Object Id | Text |
The Salesforce object ID. |
File Path | Text | The file path. |
Returns
Returns a Boolean value of True if the download was successful, otherwise returns False.